<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "user".
 *
 * @property string $id
 * @property string $nickname
 * @property string $portrait
 * @property string $gender
 * @property string $mobile
 * @property string $email
 * @property string $city
 * @property string $province
 * @property string $country
 * @property string $data
 * @property string $open_id
 * @property string $state
 * @property string $app_id
 * @property integer $create_time
 */
class User extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'user';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'nickname', 'portrait', 'gender', 'open_id'], 'required'],
            [['create_time'], 'integer'],
            [['id', 'state', 'app_id'], 'string', 'max' => 36],
            [['nickname'], 'string', 'max' => 20],
            [['portrait', 'data'], 'string', 'max' => 300],
            [['gender', 'city', 'province', 'country'], 'string', 'max' => 10],
            [['mobile'], 'string', 'max' => 11],
            [['email'], 'string', 'max' => 30],
            [['open_id'], 'string', 'max' => 100],
            [['open_id'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'nickname' => 'Nickname',
            'portrait' => 'Portrait',
            'gender' => 'Gender',
            'mobile' => 'Mobile',
            'email' => 'Email',
            'city' => 'City',
            'province' => 'Province',
            'country' => 'Country',
            'data' => 'Data',
            'open_id' => 'Open ID',
            'state' => 'State',
            'app_id' => 'App ID',
            'create_time' => 'Create Time',
        ];
    }
}
